﻿namespace WMS6.Web.Outbound
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.UserControls;

    public class ShippingQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnSearch;
        protected DropDownList ddlActualShipDate;
        protected DropDownList ddlBillToID;
        protected DropDownList ddlConsigneeID;
        protected DropDownList ddlDeliveryDate;
        protected DropDownList ddlExternOrderID;
        protected DropDownList ddlOrderDate;
        protected DropDownList ddlOrderGroup;
        protected DropDownList ddlOrderID;
        protected DropDownList ddlOwnerID;
        protected DropDownList ddlPriority;
        protected DropDownList ddlReferenceNum;
        protected DropDownList ddlRequestedShipDate;
        protected DropDownList ddlStatusOper;
        protected DropDownList ddlTypeOper;
        protected HtmlForm F7060;
        protected HtmlInputHidden hdnActionID;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnDataFormat;
        protected HtmlImage img1;
        protected HtmlImage img2;
        protected HtmlImage img3;
        protected HtmlImage img4;
        protected Label lblActualShipDate;
        protected Label lblAllocationQuery;
        protected Label lblBillToID;
        protected Label lblConsigneeID;
        protected Label lblDeliveryDate;
        protected Label lblExternOrderID;
        protected Label lblOrderDate;
        protected Label lblOrderGroup;
        protected Label lblOrderID;
        protected Label lblOwnerID;
        protected Label lblPriority;
        protected Label lblReferenceNum;
        protected Label lblRequestedShipDate;
        protected Label lblStatus;
        protected Label lblType;
        protected MultipleSelectControl MSCStatus;
        protected MultipleSelectControl MSCType;
        protected HtmlLink mycss;
        protected TextBox txtActualShipDate;
        protected TextBox txtActualShipDate2;
        protected TextBox txtBillToID;
        protected TextBox txtConsigneeID;
        protected TextBox txtDeliveryDate;
        protected TextBox txtDeliveryDate2;
        protected TextBox txtExternOrderID;
        protected TextBox txtOrderDate;
        protected TextBox txtOrderDate2;
        protected TextBox txtOrderGroup;
        protected TextBox txtOrderID;
        protected TextBox txtOwnerID;
        protected TextBox txtPriority;
        protected TextBox txtReferenceNum;
        protected TextBox txtRequestedShipDate;
        protected TextBox txtRequestedShipDate2;

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer("ShippingList.aspx", false);
        }

        private void LoadDDl()
        {
            base.BindData2DDLBySysCode(this.MSCType, "OrderType");
            base.BindData2DDLBySysCode(this.MSCStatus, "OrderStatus");
            base.InitQueryDDL(this.ddlOrderID, 0);
            base.InitQueryDDL(this.ddlOwnerID, 0);
            base.InitQueryDDL(this.ddlOrderDate, 1);
            base.InitQueryDDL(this.ddlRequestedShipDate, 1);
            base.InitQueryDDL(this.ddlActualShipDate, 1);
            base.InitQueryDDL(this.ddlDeliveryDate, 1);
            base.InitQueryDDL(this.ddlPriority, 0);
            base.InitQueryDDL(this.ddlOrderGroup, 0);
            base.InitQueryDDL(this.ddlTypeOper, 0);
            this.ddlTypeOper.SelectedValue = "One Of";
            base.InitQueryDDL(this.ddlStatusOper, 0);
            this.ddlStatusOper.SelectedValue = "One Of";
            base.InitQueryDDL(this.ddlExternOrderID, 0);
            base.InitQueryDDL(this.ddlConsigneeID, 0);
            base.InitQueryDDL(this.ddlBillToID, 0);
            base.InitQueryDDL(this.ddlReferenceNum, 0);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadDDl();
            }
        }

        public string ActualShipDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtActualShipDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtActualShipDate.Text.Trim(), this.ddlActualShipDate.SelectedValue, this.txtActualShipDate2.Text.Trim(), "ActualShipDate");
                }
                return "";
            }
        }

        public string BillToID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtBillToID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtBillToID.Text.Trim(), this.ddlBillToID.SelectedValue);
                }
                return "";
            }
        }

        public string ConsigneeID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtConsigneeID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtConsigneeID.Text.Trim(), this.ddlConsigneeID.SelectedValue);
                }
                return "";
            }
        }

        public string DeliveryDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtDeliveryDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtDeliveryDate.Text.Trim(), this.ddlDeliveryDate.SelectedValue, this.txtDeliveryDate2.Text.Trim(), "DeliveryDate");
                }
                return "";
            }
        }

        public string ExternOrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtExternOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtExternOrderID.Text.Trim(), this.ddlExternOrderID.SelectedValue);
                }
                return "";
            }
        }

        public string OrderDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOrderDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOrderDate.Text.Trim(), this.ddlOrderDate.SelectedValue, this.txtOrderDate2.Text.Trim(), "OrderDate");
                }
                return "";
            }
        }

        public string OrderGroup
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOrderGroup.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOrderGroup.Text.Trim(), this.ddlOrderGroup.SelectedValue);
                }
                return "";
            }
        }

        public string OrderID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOrderID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOrderID.Text.Trim(), this.ddlOrderID.SelectedValue);
                }
                return "";
            }
        }

        public string OwnerID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtOwnerID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtOwnerID.Text.Trim(), this.ddlOwnerID.SelectedValue);
                }
                return "";
            }
        }

        public string Priority
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtPriority.Text.Trim()))
                {
                    return base.GetParamsString(this.txtPriority.Text.Trim(), this.ddlPriority.SelectedValue);
                }
                return "";
            }
        }

        public string ReferenceNum
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtReferenceNum.Text))
                {
                    return base.GetParamsString(this.txtReferenceNum.Text, this.ddlReferenceNum.SelectedValue);
                }
                return "";
            }
        }

        public string RequestedShipDate
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtRequestedShipDate.Text.Trim()))
                {
                    return base.GetParamsString(this.txtRequestedShipDate.Text.Trim(), this.ddlRequestedShipDate.SelectedValue, this.txtRequestedShipDate2.Text.Trim(), "RequestedShipDate");
                }
                return "";
            }
        }

        public string Status
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCStatus.ReturnValue))
                {
                    return base.GetParamsString(this.MSCStatus.ReturnValue, this.ddlStatusOper.SelectedValue);
                }
                return "";
            }
        }

        public string Type
        {
            get
            {
                if (!string.IsNullOrEmpty(this.MSCType.ReturnValue))
                {
                    return base.GetParamsString(this.MSCType.ReturnValue, this.ddlTypeOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

